home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Multiple__47431192002.psc / Standard Edition / Forms / frmFileChoose.frm (.txt) next >
Encoding:
Visual Basic Form  |  2002-01-09  |  4.8 KB  |  155 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
  3. Begin VB.Form frmFileChoose 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Send File"
  6.    ClientHeight    =   2910
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   4380
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   194
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   292
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin MSComDlg.CommonDialog cdgSelect 
  18.       Left            =   240
  19.       Top             =   1200
  20.       _ExtentX        =   847
  21.       _ExtentY        =   847
  22.       _Version        =   393216
  23.    End
  24.    Begin VB.CommandButton cmdCancel 
  25.       Caption         =   "Cancel"
  26.       Height          =   285
  27.       Left            =   3240
  28.       TabIndex        =   6
  29.       Top             =   2520
  30.       Width           =   975
  31.    End
  32.    Begin VB.CommandButton cmdSend 
  33.       Caption         =   "&Send File"
  34.       Enabled         =   0   'False
  35.       Height          =   285
  36.       Left            =   2040
  37.       TabIndex        =   5
  38.       Top             =   2520
  39.       Width           =   975
  40.    End
  41.    Begin VB.TextBox txtComments 
  42.       Appearance      =   0  'Flat
  43.       Height          =   1335
  44.       Left            =   120
  45.       MaxLength       =   200
  46.       MultiLine       =   -1  'True
  47.       TabIndex        =   4
  48.       Top             =   1080
  49.       Width           =   4125
  50.    End
  51.    Begin VB.CommandButton cmdBrowse 
  52.       Caption         =   "&Browse"
  53.       Height          =   285
  54.       Left            =   3510
  55.       TabIndex        =   2
  56.       Top             =   360
  57.       Width           =   735
  58.    End
  59.    Begin VB.TextBox txtFile 
  60.       Appearance      =   0  'Flat
  61.       Height          =   285
  62.       Left            =   120
  63.       TabIndex        =   1
  64.       Top             =   360
  65.       Width           =   3375
  66.    End
  67.    Begin VB.Label lblComments 
  68.       AutoSize        =   -1  'True
  69.       Caption         =   "&Comment (Up to 200 characters):"
  70.       Height          =   195
  71.       Left            =   120
  72.       TabIndex        =   3
  73.       Top             =   840
  74.       Width           =   2340
  75.    End
  76.    Begin VB.Label lblFile 
  77.       AutoSize        =   -1  'True
  78.       Caption         =   "The &File To Send:"
  79.       Height          =   195
  80.       Left            =   120
  81.       TabIndex        =   0
  82.       Top             =   120
  83.       Width           =   1275
  84.    End
  85. Attribute VB_Name = "frmFileChoose"
  86. Attribute VB_GlobalNameSpace = False
  87. Attribute VB_Creatable = False
  88. Attribute VB_PredeclaredId = True
  89. Attribute VB_Exposed = False
  90. Option Explicit
  91. Dim MyID        As Long
  92. Dim SendClicked As Boolean
  93. Private Sub cmdBrowse_Click()
  94.   'Setup error handling
  95.   On Error GoTo Err_DetermineErr
  96.   'Set Properties for the Common Dialog Control
  97.   With cdgSelect
  98.     'An error will occur if user clicks Cancel
  99.     .CancelError = True
  100.     .DialogTitle = "Select file for transfer"
  101.     .Filter = "All Files (*.*)|*.*"
  102.     .ShowOpen
  103.   End With
  104.   'Show the user the selected file
  105.   txtFile = cdgSelect.FileName
  106.   Exit Sub
  107. Err_DetermineErr:
  108.   'Cancel Was Selected, Do Nothing
  109. End Sub
  110. Private Sub cmdCancel_Click()
  111.   'unload the form
  112.   Unload Me
  113. End Sub
  114. Private Sub cmdSend_Click()
  115.   With ftSend(MyID)
  116.     .Comment = txtComments
  117.     .FileSize = CDbl(FileLen(txtFile))
  118.     .FileToSend = txtFile
  119.     .frmSend.InitTransfer MyID
  120.   End With
  121.   SendClicked = True
  122.   Unload Me
  123. End Sub
  124. Private Sub Form_Unload(Cancel As Integer)
  125.     Dim MsgRet As VbMsgBoxResult 'Message Box Return Value
  126.   'If there is a valid file displayed in txtFile, Prompt
  127.   'the user to verify the cancel command
  128.   If (cmdSend.Enabled = True) And (SendClicked = False) Then
  129.     MsgRet = MsgBox("You Have Chosen A File To Send." & _
  130.                        vbNewLine & vbNewLine & "Are You Sure" & _
  131.                        " You Want To Cancel?", vbYesNo, _
  132.                        "Verify Cancel")
  133.     'If yes, remove form from memory. else cancel unload
  134.     If MsgRet = vbYes Then Set frmFileChoose = Nothing Else _
  135.                                                Cancel = -1
  136.   Else
  137.     'Remove the form from memory
  138.     Set ftSend(MyID).frmChoose = Nothing
  139.   End If
  140. End Sub
  141. Private Sub txtFile_Change()
  142.   On Error GoTo ErrHandler
  143.   'Disable the send command button if no file is selected
  144.   If FileLen(txtFile) <> 0 Then cmdSend.Enabled = True Else _
  145.                                 cmdSend.Enabled = False
  146.   Exit Sub
  147. ErrHandler:
  148.   'The file doesnt exist, so disable the send button
  149.   cmdSend.Enabled = False
  150. End Sub
  151. Public Function ChooseSend(ByVal ID As Long)
  152.   MyID = ID
  153.   Me.Visible = True
  154. End Function
  155.